package cn.itcast.bos.web.interceptor;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

import cn.itcast.crm.domain.Customer;

public class CustomerInterceptor extends MethodFilterInterceptor {

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		Customer customer = (Customer) ServletActionContext.getRequest().getSession().getAttribute("customer");
		if (customer==null) {
			return "login";
			
		}
		return invocation.invoke();
	}

	
	
}
